<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      textarea {
        display: block;
        width: 300px;
        height: 200px;
        border: 1px solid #cecece;
      }
    </style>
  </head>
  <body>
    <textarea></textarea>
    <input type="text" placeholder="按住ctrl+Enter键发送消息" />
    <script>
      var oTextarea = document.querySelector("textarea");
      var oInput = document.querySelector("input");
      oInput.onkeydown = function (e) {
        if (e.ctrlKey && e.keyCode == 13) {
          oTextarea.innerHTML += oInput.value + "<br>";
          oInput.value = "";
        }
        oTextarea.document.documentElement.scroll = 100000 + "px";
      };
    </script>
  </body>
</html>
